package com.ruoyi.web.controller.system.api.cc;

import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.interceptor.Authentication;
import com.ruoyi.system.api.ResponseWithData;
import com.ruoyi.system.api.domain.PartInfo;
import com.ruoyi.system.api.service.SparePartsService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;

/**
 * @ClassName SparePartsController
 * @Description: 备件管理
 * @Author wlf
 * @Date 2020/3/2
 * @Version V1.0
 **/
@Api(tags="备件管理")
@Controller
@RequestMapping("/api/cc/spareParts")
public class SparePartsController extends BaseController {

    @Autowired
    private SparePartsService sparePartsService;

    private static final Logger log = LoggerFactory.getLogger(SparePartsController.class);
    /**
     * 获取工程师名下备件接口
     * @methodName: queryPartByFseId
     * @description: TODO
     * @param enginnerId
     * @param status
     * @return: com.ruoyi.system.api.ResponseWithData<?>
     * @author: wlf
     * @date: 2020/3/2 11:09
    **/
    @GetMapping("/queryPartByFseId")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "获取工程师名下备件接口", httpMethod = "GET", notes = "获取工程师名下备件接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "enginnerId", value = "工程师ID", required = true, dataType="String"),
            @ApiImplicitParam(name = "status", value = "备件状态", dataType="String"),
            @ApiImplicitParam(name = "partNo", value = "备件号", dataType="String"),
            @ApiImplicitParam(name = "partName", value = "备件名称", dataType="String"),
            @ApiImplicitParam(name = "custName", value = "用户名称", dataType="String")
    })
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> queryPartByFseId(
            @RequestParam(value="enginnerId",required=true)  String enginnerId,
            @RequestParam(value="status",required=false)  String status,
            @RequestParam(value="partNo",required=false)  String partNo,
            @RequestParam(value="partName",required=false)  String partName,
            @RequestParam(value="custName",required=false)  String custName){
        try {
            return sparePartsService.queryPartByFseId(enginnerId, status, partNo, partName, custName);
        }catch (Exception e){
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }

    /**
     * 获取工程师名下备件接口（POST）  备件转移
     * @methodName: queryPartByFseIdPost
     * @description: TODO
     * @param params
     * @return: com.ruoyi.system.api.ResponseWithData<?>
     * @author: wlf
     * @date: 2020/3/25 14:09
     **/
    @PostMapping("/queryPartByFseIdPostZY")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "2.74获取工程师转移备件列表接口", httpMethod = "POST", notes = "获取工程师名下备件接口POST方式")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "enginner_id", value = "工程师ID", required = true, dataType="String"),
            @ApiImplicitParam(name = "Status", value = "备件状态", dataType="String"),
            @ApiImplicitParam(name = "Part_id", value = "备件id", dataType="String"),
            @ApiImplicitParam(name = "Part_no", value = "备件号", dataType="String"),
            @ApiImplicitParam(name = "Part_name", value = "备件名称", dataType="String"),
            @ApiImplicitParam(name = "CustName", value = "用户名称", dataType="String"),
            @ApiImplicitParam(name = "Part_DebitNo", value = "借货单号", dataType="String"),
            @ApiImplicitParam(name = "istodo", value = "是否待处理", dataType="String")
    })
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> queryPartByFseIdPostZY(@ApiParam(name="params", value="获取工程师名下备件",required=true) @RequestBody String params){
        try {
            PartInfo info = new PartInfo();
            if (StringUtils.isNotEmpty(params)) {
                info = JSONObject.parseObject(params, PartInfo.class);
            }
            return sparePartsService.queryPartByFseIdPost2(info);
        }catch (Exception e){
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }


    /**
     * 获取工程师名下备件接口（POST）
     * @methodName: queryPartByFseIdPost
     * @description: TODO
     * @param params
     * @return: com.ruoyi.system.api.ResponseWithData<?>
     * @author: wlf
     * @date: 2020/3/25 14:09
     **/
    @PostMapping("/queryPartByFseIdPost")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "2.74获取工程师转移备件列表接口", httpMethod = "POST", notes = "获取工程师名下备件接口POST方式")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "enginner_id", value = "工程师ID", required = true, dataType="String"),
            @ApiImplicitParam(name = "Status", value = "备件状态", dataType="String"),
            @ApiImplicitParam(name = "Part_id", value = "备件id", dataType="String"),
            @ApiImplicitParam(name = "Part_no", value = "备件号", dataType="String"),
            @ApiImplicitParam(name = "Part_name", value = "备件名称", dataType="String"),
            @ApiImplicitParam(name = "CustName", value = "用户名称", dataType="String"),
            @ApiImplicitParam(name = "Part_DebitNo", value = "借货单号", dataType="String"),
            @ApiImplicitParam(name = "istodo", value = "是否待处理", dataType="String")
    })
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> queryPartByFseIdPost(@ApiParam(name="params", value="获取工程师名下备件",required=true) @RequestBody String params){
        try {
            PartInfo info = new PartInfo();
            if (StringUtils.isNotEmpty(params)) {
                info = JSONObject.parseObject(params, PartInfo.class);
            }
            return sparePartsService.queryPartByFseIdPost(info);
        }catch (Exception e){
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }

    /**
     * 获取其他工程师名下备件接口
     * @methodName: getPartInfoByCode
     * @description: TODO
     * @param params
     * @return: com.ruoyi.system.api.ResponseWithData<?>
     * @author: wlf
     * @date: 2020/3/2 14:04
     **/
    @PostMapping("/getPartInfoByCode")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "获取其他工程师名下备件接口", httpMethod = "POST", notes = "获取其他工程师名下备件接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "enginnerId", value = "工程师id", required = true, dataType="String"),
            @ApiImplicitParam(name = "status", value = "备件状态", required = true, dataType="String"),
            @ApiImplicitParam(name = "partCode", value = "备件号", required = true, dataType="String") ,
            @ApiImplicitParam(name = "enginnerName", value = "工程师姓名", required = true, dataType="String")
    })
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> getPartInfoByCode(@RequestBody Map<String,Object> params){
        try {
            return sparePartsService.getPartInfoByCode(params);
        }catch (Exception e){
            e.printStackTrace();
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }

    /**
     * 获取备件物流接口
     * @methodName: getLogisticsInfoByNumber
     * @description: TODO
     * @param logisticNo
     * @param shipercode
     * @param custname
     * @return: com.ruoyi.system.api.ResponseWithData<?>
     * @author: wlf
     * @date: 2020/3/2 14:04
     **/
    @GetMapping("/getLogisticsInfoByNumber")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "获取备件物流接口", httpMethod = "GET", notes = "获取备件物流接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "logisticNo", value = "物流单号", required = true, dataType="String") ,
            @ApiImplicitParam(name = "shipercode", value = "物流公司编码", required = true, dataType="String"),
            @ApiImplicitParam(name = "custname", value = "工程师手机后4位", dataType="String")
    })
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> getLogisticsInfoByNumber(
            @RequestParam(value = "logisticNo", required = true) String logisticNo,
            @RequestParam(value = "shipercode", required = true) String shipercode,
            @RequestParam(value = "custname", required = false) String custname) {
        try {
            // custname为工程师手机号后4位
//            if (StringUtils.isNotEmpty(custname) && custname.length() > 4) {
//                custname = custname.substring(custname.length() - 4, custname.length());
//            }
            return sparePartsService.getLogisticsInfoByNumber(logisticNo, shipercode, custname);
        }catch (Exception e){
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }

    /**
     * 备件收货接口(支持批量，批量时备件id逗号分隔)
     * @methodName: partReceiving
     * @description: TODO
     * @param params
     * @return: com.ruoyi.system.api.ResponseWithData<?>
     * @author: wlf
     * @date: 2020/3/2 14:04
     **/
    @Log(title = "备件收货接口", businessType = BusinessType.UPDATE)
    @PostMapping("/partReceiving")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "备件收货接口", httpMethod = "POST", notes = "备件收货接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "enginner_id", value = "工程师id", required = true, dataType="String") ,
            @ApiImplicitParam(name = "Part_id", value = "备件id", required = true, dataType="String"),
            @ApiImplicitParam(name = "Remark", value = "备注", dataType="String")
    })
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> partReceiving(@RequestBody Map<String, Object> params){
        try {
            return sparePartsService.partReceiving(params);
        }catch (Exception e){
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }

    /**
     * 备件拆分接口
     * @methodName: partSplit
     * @description: TODO
     * @param params
     * @return: com.ruoyi.system.api.ResponseWithData<?>
     * @author: wlf
     * @date: 2020/3/2 14:04
     **/
    @Log(title = "备件拆分接口", businessType = BusinessType.UPDATE)
    @PostMapping("/partSplit")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "备件拆分接口", httpMethod = "POST", notes = "备件拆分接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "enginner_id", value = "工程师id", required = true, dataType="String") ,
            @ApiImplicitParam(name = "Part_id", value = "备件id", required = true, dataType="String")
    })
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> partSplit(@RequestBody Map<String, Object> params){
        try {
            return sparePartsService.partSplit(params);
        }catch (Exception e){
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }

    /**
     * 备件绑码接口
     * @methodName: partBind
     * @description: TODO
     * @param params
     * @return: com.ruoyi.system.api.ResponseWithData<?>
     * @author: wlf
     * @date: 2020/3/31 16:04
     **/
    @Log(title = "备件绑码接口", businessType = BusinessType.UPDATE)
    @PostMapping("/partBind")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "备件绑码接口", httpMethod = "POST", notes = "备件绑码接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "enginner_id", value = "工程师id", required = true, dataType="String") ,
            @ApiImplicitParam(name = "Part_id", value = "备件id", required = true, dataType="String"),
            @ApiImplicitParam(name = "Rebarcode", value = "条码", required = true, dataType="String")
    })
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> partBind(@RequestBody Map<String, Object> params){
        try {
            return sparePartsService.partBind(params);
        }catch (Exception e){
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }

    /**
     * 备件还库接口
     * @methodName: partBindReturnHandle
     * @description: TODO
     * @param params
     * @return: com.ruoyi.system.api.ResponseWithData<?>
     * @author: wlf
     * @date: 2020/3/30 11:14
     **/
    @Log(title = "备件还库接口", businessType = BusinessType.UPDATE)
    @PostMapping("/partBindReturnHandle")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "备件还库接口", httpMethod = "POST", notes = "备件还库接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "bindReturn", value = "还库信息", required = true, dataType="String") ,
            @ApiImplicitParam(name = "bindReturnPartInfo", value = "备件信息", required = true, dataType="String")
    })
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> partBindReturnHandle(@RequestBody String params){
        try {
            return sparePartsService.partBindReturnHandle(params);
        }catch (Exception e){
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }

    /**
     * 非工作时间紧急发货时，调用2.66非工作日判断接口
     * @methodName: checkTodayIsOnjobInfo
     * @description: TODO
     * @return: com.ruoyi.system.api.ResponseWithData<?>
     * @author: wlf
     * @date: 2020/5/20 15:18
     **/
    @GetMapping (value = "/checkTodayIsOnjobInfo")
    @ResponseBody
    @Authentication(tokenRequired = false, signRequired = false)
    @ApiOperation(value = "非工作日判断接口", httpMethod = "GET", notes = "非工作日判断接口")
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> checkTodayIsOnjobInfo(){
        try {
            return sparePartsService.checkTodayIsOnjobInfo();
        }catch (Exception e){
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }

    /**
     * 备件借货申请接口
     * @methodName: partBorrowApply
     * @description: TODO
     * @param spareParts
     * @return: com.ruoyi.system.api.ResponseWithData<?>
     * @author: wlf
     * @date: 2020/3/2 14:04
     **/
    @RepeatSubmit
    @Log(title = "备件借货申请", businessType = BusinessType.INSERT)
    @PostMapping(value = "/partBorrowApply", produces = "application/json")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "备件借货申请", httpMethod = "POST", notes = "备件借货申请")
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> partBorrowApply(@RequestBody String spareParts){
        try {
            return sparePartsService.partBorrowApply(spareParts);
        }catch (Exception e){
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }

    /**
     * 获取TL名下FSE备件接口
     * @methodName: queryPartByTlId
     * @description: TODO
     * @param params
     * @return: com.ruoyi.system.api.ResponseWithData<?>
     * @author: wlf
     * @date: 2020/3/2 14:04
     **/
    @PostMapping("/queryPartByTlId")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "获取TL名下FSE备件接口", httpMethod = "POST", notes = "获取TL名下FSE备件接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tlId", value = "Tl ID", required = true, dataType="String"),
            @ApiImplicitParam(name = "enginnerId", value = "工程师id", required = true, dataType="String"),
            @ApiImplicitParam(name = "status", value = "备件状态", required = true, dataType="String"),
            @ApiImplicitParam(name = "partCode", value = "备件号", required = true, dataType="String") ,
            @ApiImplicitParam(name = "enginnerName", value = "工程师姓名", required = true, dataType="String")
    })
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> queryPartByTlId(@RequestBody Map<String,Object> params){
        try {
            return sparePartsService.queryPartByTlId(params);
        }catch (Exception e){
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }

    /**
     * 查询备件是否关联草稿
     * @methodName: queryPartDraft
     * @description: TODO
     * @param enginnerId
     * @param partId
     * @return: com.ruoyi.system.api.ResponseWithData<?>
     * @author: wlf
     * @date: 2020/3/30 9:42
     **/
    @GetMapping ("/queryPartDraft")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "查询备件是否关联草稿", httpMethod = "GET", notes = "查询备件是否关联草稿")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "enginnerId", value = "工程师id", required = true, dataType="String"),
            @ApiImplicitParam(name = "partId", value = "备件id", required = true, dataType="String")
    })
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> queryPartDraft(
            @RequestParam(value="enginnerId",required=true) String enginnerId,
            @RequestParam(value="partId",required=true) String partId){
        try {
            return sparePartsService.queryPartDraft(enginnerId, partId);
        }catch (Exception e){
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }

    /**
     * 备件转移接口
     * @methodName: partChangeHandle
     * @description: TODO
     * @param params
     * @return: com.ruoyi.system.api.ResponseWithData<?>
     * @author: wlf
     * @date: 2020/3/2 14:04
     **/
    @Log(title = "备件转移接口", businessType = BusinessType.UPDATE)
    @PostMapping(value = "/partChangeHandle", produces = "application/json")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "备件转移接口", httpMethod = "POST", notes = "备件转移接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "enginner_id", value = "工程师id", required = true, dataType="String"),
            @ApiImplicitParam(name = "new_enginner_id", value = "转移工程师id", required = true, dataType="String"),
            @ApiImplicitParam(name = "partInfo", value = "备件信息", required = true, dataType="String")
//            @ApiImplicitParam(name = "part_id", value = "备件id", required = true, dataType="String"),
//            @ApiImplicitParam(name = "part_no", value = "备件号", required = true, dataType="String"),
//            @ApiImplicitParam(name = "Part_name", value = "备件名称", required = true, dataType="String"),
//            @ApiImplicitParam(name = "Part_qty", value = "备件数量", required = true, dataType="String"),
//            @ApiImplicitParam(name = "change_qty", value = "转移数量", required = true, dataType="String")
    })
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> partChangeHandle(@RequestBody String params){
        try {
            return sparePartsService.partChangeHandle(params);
        }catch (Exception e){
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }

    /**
     * 消耗品清单接口
     * @methodName: consumablesList
     * @description: TODO
     * @param tableName
     * @param engineerId
     * @return: com.ruoyi.system.api.ResponseWithData<?>
     * @author: wlf
     * @date: 2020/4/7 16:14
     **/
    @GetMapping(value = "/consumablesList", produces = "application/json")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "消耗品清单接口", httpMethod = "GET", notes = "消耗品清单接口")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "tableName", name = "tableName", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(value = "engineerId", name = "engineerId", required = true, dataType = "String", paramType = "query")
    })
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> consumablesList(@RequestParam(value = "tableName") String tableName, @RequestParam(value = "engineerId") Long engineerId) {
        try {
            return sparePartsService.consumablesList(tableName, engineerId);
        }catch (Exception e){
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }

    /**
     * 获取cc端省市区数据
     * @methodName: ccAddressData
     * @description: TODO
     * @return: com.ruoyi.system.api.ResponseWithData<?>
     * @author: wlf
     * @date: 2020/4/23 10:10
     **/
    @GetMapping(value = "/ccAddressData")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "获取cc端省市区数据", httpMethod = "GET", notes = "获取cc端省市区数据")
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> ccAddressData() {
        try {
            return sparePartsService.ccAddressData();
        }catch (Exception e){
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }


    /**
     * 备件号查询Price及备件名称接口
     * @methodName: QueryPriceByPartCode
     * @description: TODO
     * @param params
     * @return: com.ruoyi.system.api.ResponseWithData<?>
     * @author: wlf
     * @date: 2020/5/12 14:04
     **/
    @PostMapping("/QueryPriceByPartCode")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "备件号查询Price及备件名称接口", httpMethod = "POST", notes = "备件号查询Price及备件名称接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "partcode", value = "备件号", required = true, dataType="String")
    })
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> QueryPriceByPartCode(@RequestBody Map<String, Object> params){
        try {
            return sparePartsService.QueryPriceByPartCode(params);
        }catch (Exception e){
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }


    @PostMapping("/queryPartByFseIdPostBg")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "服务报告/电话解决报告专用获取工程师名下备件接口POST方式", httpMethod = "POST", notes = "获取工程师名下备件接口POST方式")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "enginner_id", value = "工程师ID", required = true, dataType="String"),
            @ApiImplicitParam(name = "Status", value = "备件状态", dataType="String"),
            @ApiImplicitParam(name = "Part_id", value = "备件id", dataType="String"),
            @ApiImplicitParam(name = "Part_no", value = "备件号", dataType="String"),
            @ApiImplicitParam(name = "Part_name", value = "备件名称", dataType="String"),
            @ApiImplicitParam(name = "CustName", value = "用户名称", dataType="String"),
            @ApiImplicitParam(name = "Part_DebitNo", value = "借货单号", dataType="String"),
            @ApiImplicitParam(name = "istodo", value = "是否待处理", dataType="String")
    })
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> queryPartByFseIdPostBg(@ApiParam(name="params", value="获取工程师名下备件",required=true) @RequestBody String params){
        try {
            PartInfo info = new PartInfo();
            if (StringUtils.isNotEmpty(params)) {
                info = JSONObject.parseObject(params, PartInfo.class);
            }
            return sparePartsService.queryPartByFseIdPostBg(info);
        }catch (Exception e){
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }
    @PostMapping("/queryPartByFseIdPostCC")
    @ResponseBody
    @Authentication(tokenRequired = true, signRequired = true)
    @ApiOperation(value = "服务报告/电话解决报告专用获取工程师名下备件接口POST方式", httpMethod = "POST", notes = "获取工程师名下备件接口POST方式")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "enginner_id", value = "工程师ID", required = true, dataType="String"),
            @ApiImplicitParam(name = "Status", value = "备件状态", dataType="String"),
            @ApiImplicitParam(name = "Part_id", value = "备件id", dataType="String"),
            @ApiImplicitParam(name = "Part_no", value = "备件号", dataType="String"),
            @ApiImplicitParam(name = "Part_name", value = "备件名称", dataType="String"),
            @ApiImplicitParam(name = "CustName", value = "用户名称", dataType="String"),
            @ApiImplicitParam(name = "Part_DebitNo", value = "借货单号", dataType="String"),
            @ApiImplicitParam(name = "istodo", value = "是否待处理", dataType="String")
    })
    @ApiResponses({
            @ApiResponse(code = 500, message = "code 为 500 系统异常"),
            @ApiResponse(code = 200, message = "code 为 200 成功")
    })
    public ResponseWithData<?> queryPartByFseIdPostCC(@ApiParam(name="params", value="获取工程师名下备件",required=true) @RequestBody String params){
        try {
            PartInfo info = new PartInfo();
            if (StringUtils.isNotEmpty(params)) {
                info = JSONObject.parseObject(params, PartInfo.class);
            }
            return sparePartsService.queryPartByFseIdPostCC(info);
        }catch (Exception e){
            log.error("程序异常", e.getMessage());
            return new ResponseWithData().error().msg("系统异常").code(500);
        }
    }
}
